package view.component.weapon.light_bow_gun
{
	import enums.main.UISize;
	
	import feathers.controls.Label;
	import feathers.data.ListCollection;
	
	import model.vo.weapon.BaseBowGunWeaponVo;
	
	import view.component.weapon.WeaponListView;
	import view.render.weapon.BaseBowGunSimpleItem;
	
	
	/**
	 * 轻弩简表
	 * @author £iang
	 * 
	 */	
	public class LightBowGunListView extends WeaponListView
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** 攻击力标题 */
		public var attackTitle:Label;
		/** 速射标题 */
		public var quickTitle:Label;
		/** 装、反、偏标题 */
		public var otherTitle:Label;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		override protected function initializeOther():void
		{
			attackTitle = new Label();
			attackTitle.text = "攻击力";
			titleGroup.addChild( attackTitle );
			
			quickTitle = new Label();
			quickTitle.text = "速射";
			titleGroup.addChild( quickTitle );
			
			otherTitle = new Label();
			otherTitle.text = "装|反|偏";
			titleGroup.addChild( otherTitle );
		}
		
		/**
		 * 绘制函数 
		 * 
		 */		
		override protected function draw():void
		{
			super.draw();
			var labelY:Number = ( UISize.LIST_TITLE_H - 
				43 ) / 2 * this.dpiScale;
			var leftPadding:Number = UISize.TITLE_PADDING_LEFT * this.dpiScale;
			var firstTitleFullW:Number;
			
			firstTitle.y = labelY;
			firstTitle.x = leftPadding;
			firstTitleFullW = UISize.MAIN_W * 0.4;
			firstTitle.width = firstTitleFullW - leftPadding;
			
			attackTitle.y = labelY;
			attackTitle.x = UISize.MAIN_W * 0.4;
			attackTitle.width  = UISize.MAIN_W * 0.2;
			
			quickTitle.y = labelY;
			quickTitle.x = UISize.MAIN_W * 0.6;
			quickTitle.width  = UISize.MAIN_W * 0.2;
			
			otherTitle.y = labelY;
			otherTitle.x = UISize.MAIN_W * 0.8;
			otherTitle.width  = UISize.MAIN_W * 0.2;
			
			list.y = UISize.LIST_TITLE_H * this.dpiScale;
		}
		
		/**
		 * 设置列表数据 
		 * @param dataVec 数据
		 * 
		 */		
		public function setListData( dataVec:Vector.<BaseBowGunWeaponVo> ):void
		{
			var i:int;
			var len:int = dataVec.length;
			
			_listData = new ListCollection([]);
			
			for( i = 0; i < len; i++)
			{
				var item:BaseBowGunSimpleItem = new BaseBowGunSimpleItem();
				var tmpData:BaseBowGunWeaponVo = dataVec[ i ] as BaseBowGunWeaponVo;
				
				item.setBowGunData( tmpData );
				_listData.push( { item:item, itemData:tmpData } );
			}
			
			list.dataProvider = _listData;
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 析构函数 
		 * 
		 */		
		protected override function disposeOther():void
		{
			disposeLabels( [
				"attack", "quick", "other"
			] );
		}
		
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LightBowGunListView()
		{
			super();
			anchorlabelArr = [ "暴雪剣派生系", "b系", "c", "d", "e", "f", "g", "h" ];
			anchorArr = [ 1, 2, 3, 4, 5, 6, 7, 8 ];
		}
	}
}